<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>课工场论坛列表</title>
    <link href="css/bbs.css" rel="stylesheet">
    <script>
        function fatie() {
         var b=document.getElementById("tiezi");
         b.style.display="block";
        }

         function fabu() {
            //创建标签
        var l=document.createElement("li");
        var d=document.createElement("div");
        var i=document.createElement("img");
        var p=document.createElement("p");
        var s1=document.createElement("span");
        var s2=document.createElement("span");
        var h=  document.createElement("h1");
        var b=  document.getElementById("postList");
        //添加标签
           b.appendChild(l);
           l.appendChild(d);
           l.appendChild(h);
           l.appendChild(p);
           d.appendChild(i);
           p.appendChild(s1);
           p.appendChild(s2);

          var content=   document.getElementById("tiezi").firstElementChild.value; //获得输入值标题
             h.innerHTML=content;
        //   h.setAttribute("value","ggggg");
             i.src="images/tou0"+parseInt(Math.random()*4+1)+".jpg";
             alert(i.src);
            var ar= document.getElementById("tiezi").children;
             s1.innerHTML="版块："+ar[1].value;
             var date=new Date();
             s2.innerHTML="发表时间："+date.toLocaleString();
              var k=document.getElementById("tiezi");
             k.style.display="none";
         }
    </script>

</head>
<body>
<div class="bbs">
    <header id="head" onclick="fatie()"><span>我要发帖</span></header>
    <section id="sst">
        <ul id="postList">
            <li>
                <div><img src="images/tou02.jpg"></div>
                <h1>ggggg</h1>
                <p><span>版块：新手报到</span><span>发表时间：2019-11-18 17:28</span>
                </p>
            </li>
            <li>
                <div>
                    <img src="images/tou01.jpg">
                </div>
                <h1>ddddd</h1>
                <p><span>版块：新课来了</span><span>发表时间：2019-11-18 17:27</span></p>
            </li>
        </ul>
    </section>

    <div class="post" id="tiezi">
        <input class="title" placeholder="请输入标题（1-50个字符）">
        所属版块：<select>
        <option>请选择版块</option>
        <option>电子书籍</option>
        <option>新课来了</option>
        <option>新手报到</option>
        <option>职业规划</option>
    </select>
        <textarea class="content"></textarea>
        <input class="btn" value="发布" onclick="fabu()">
    </div>
</div>
</body>
</html>